<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="t_cer" :rules="rules" label-width="100px" id="mvcfm">
          <el-button @click="gotoPage('/mes/certificate/ModeCertificate?'+vueparams+'')" type='success' size="mini"><i class='fa fa-edit'></i>修改</el-button>
          <el-button @click="gotoPage('/mes/certificate/CertificateStatistics?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
          <el-button @click="down_excel('')" type='primary' size="mini"><i class='fa fa-download'></i>导出</el-button>
          <el-button @click="gotoPage('/mes/certificate/CriticalRelations?'+vueparams+'')" type='danger' size="mini">查看关系</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 证书详情 </span>
          </div>
          <div>
            <el-row>
              <el-col :span="24">
                <el-form-item label="证书编号" prop="">
                  {{t_cer.certificate_num}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="认证类型" prop="">
                  {{t_cer.setup_id_desc}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="证书类型" prop="">
                  {{t_cer.certificate_type_desc}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="申请人" prop="">
                  {{t_cer.applicant_client_desc}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="申请人地址" prop="">
                  {{t_cer.applicant_client_address}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="制造商" prop="">
                  {{t_cer.production_plant_desc}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="制造商地址" prop="">
                  {{t_cer.production_plant_address}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="生产企业" prop="">
                  {{t_cer.engin_client_id_desc}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="生产企业地址" prop="">
                  {{t_cer.engin_client_id_address}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="持证人" prop="">
                  {{t_cer.cardholder_client_id_desc}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="发证机构" prop="">
                  {{t_cer.issue_client_id_desc}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="发证日期" prop="">
                  {{t_cer.issue_date}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="证书截止日期" prop="">
                  {{t_cer.validity_date}}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="证书文件" prop="">
                  {{t_cer.certificate_filed}}
                  <el-link @click="gotoPage('/xcapi/ProcessFile/DownloadFile.do?&fileverid='+t_cer.version_id+''+vueparams+'')" type='primary'>下载</el-link>
                  <el-link @click="gotoPage('/xcapi/ProcessFile/DownloadFile.do?view=true&fileverid='+t_cer.version_id+'&cpopup=reload'+vueparams+'')" type='primary'>查看</el-link>
                </el-form-item>
              </el-col>
            </el-row>
          </div>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'基本信息'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'CertificateDetails',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        t_cer: {
          certificate_num: null,
          setup_id_desc: null,
          certificate_type_desc: null,
          applicant_client_desc: null,
          applicant_client_address: null,
          production_plant_desc: null,
          production_plant_address: null,
          engin_client_id_desc: null,
          engin_client_id_address: null,
          cardholder_client_id_desc: null,
          issue_client_id_desc: null,
          issue_date: null,
          validity_date: null,
          certificate_filed: null,
        },
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "018E412E935E4B3EB6DF631BB3B46A50",
        name: "客户右菜单类型",
        selected: "基本信息"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/certificate/CertificateAction/certificateDetails?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      certificateDetailsSubmit(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/certificate/CertificateAction/certificateDetailsSubmit?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.gotoPage("/mes/certificate/ModeCertificate/modeCertificate?" + this.vueparams, data);
          this.msgSuccess(data.msg);
        })
      },
      down_excel(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/certificate/CertificateAction/down_excel?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
    },
  }
</script>
